/* ***************************************************** */
/* Arcans Team (2010), website                           */
/* Site under GNU GPL v3 Licence                         */
/* (see NOTICE and COPYING in the of the site file tree) */
/* ***************************************************** */

/* ***************************************************** */
/* module pour la gestion des utilisateurs par l'admin   */
/* ***************************************************** */
var users = (function () {
	function mod_user (idu) {
		//
		//TODO
		//
	}
	function add_user () {
		//
		//TODO
		//
		/*voile.initPaff(); voile.addElt("titre",{"texte":"Ajouter un utilisateur :"},0);
		var wrapper = voile.addElt("div",{"id":"voile_wrapper","style":"margin-left:165px;"},0);
		voile.addElt("p",{"id":"af1_alert"},wrapper);
		var tableform = voile.addElt("table","",wrapper); var row = voile.addElt("tr","",tableform);
		voile.addElt("label",{"texte":"Pseudonyme :","for":"pseudo_new","style":"font-weight:bold;"},voile.addElt("td","",row));
		voile.addElt("input",{"type":"text","id":"pseudo_new"},voile.addElt("td",{"style":"text-align:right;"},row));
		row = voile.addElt("tr","",tableform);
		voile.addElt("label",{"texte":"Email :","for":"email_new","style":"font-weight:bold;"},voile.addElt("td","",row));
		voile.addElt("input",{"type":"text","id":"email_new"},voile.addElt("td",{"style":"text-align:right;"},row));
		row = voile.addElt("tr","",tableform);
		voile.addElt("label",{"texte":"Niveau :","for":"level_new","style":"font-weight:bold"},voile.addElt("td","",row));
		var select = voile.addElt("select",{"id":"level_new"},voile.addElt("td",{"style":"text-align:right;"},row));
		voile.addElt("option",{"value":"5","texte":"Joueur"},select);
		voile.addElt("option",{"value":"10","texte":"Développeur"},select);
		voile.addElt("option",{"value":"50","texte":"Modérateur"},select);
		voile.addElt("option",{"value":"100","texte":"Administrateur"},select);
		var btsdiv = voile.addElt("div",{"id":"btsdiv","style":"text-align:right;"},0);
		voile.addElt("button",{"texte":"Valider","onclick":"users.add_new();"},btsdiv);
		voile.addElt("button",{"texte":"Annuler","onclick":"voile.initPclose();"},btsdiv);*/
	}
	return {
		mod_user: function (idu) { mod_user(idu); }, add_user: function () { add_user(); }
		/*admin_user: function (id_user,level) { admin_user(id_user,level); },
		add_new: function () {
			var af1_alert = doc.byID("af1_alert"); var pseudo_new = doc.byID("pseudo_new");
			var email_new = doc.byID("email_new");
			var regval = new RegExp(/^[\w]+[\w\-\.]{2,}$/);
			var regemail = new RegExp(/^[a-zA-Z0-9]+([_|\.|-]{1}[a-zA-Z0-9]+)*@[a-zA-Z0-9]+([_|\.|-]­{1}[a-zA-Z0-9]+)*[\.]{1}[a-z\.]{2,6}$/);
			if (pseudo_new.value == "") voile.modElt(af1_alert,{"texte":"Le champs 'pseudonyme' est vide !","style":"font-weight:bold;color:red;"});
			else if (!regval.test(pseudo_new.value))
				voile.modElt(af1_alert,{"texte":"Erreur dans le champs 'pseudonyme' !","style":"font-weight:bold;color:red;"});
			else if (email_new.value == "") voile.modElt(af1_alert,{"texte":"Le champs 'email' est vide !","style":"font-weight:bold;color:red;"});
			else if (!regemail.test(email_new.value))
				voile.modElt(af1_alert,{"texte":"Erreur dans le champs 'email' !","style":"font-weight:bold;color:red;"});
			else {
				voile.modElt(af1_alert,{"texte":"Création en cours ...","style":""});
				voile.addElt("progress",{"id":"af1_progress"},af1_alert);
				//
				//pseudo_new.style.disabled
				//
				//
				//TODO
				//
			}
		}*/
		//
	}
})();